/**
 * Copyright (c) 2024 watereyes
 * workflow is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.common.web.mapper;

import java.util.List;

import org.apache.ibatis.annotations.*;
import org.koron.ebs.mybatis.EnvSource;

import com.koron.common.bean.StaffBean;
import com.koron.common.bean.query.StaffQueryBean;

@EnvSource("_default")
public interface StaffMapper {
	
	public List<StaffBean> selectList(StaffQueryBean query);
	

	@Select("select a.*,b.loginname from tblstaff a left join PUB_USER b on a.loginid =" + "b.id where a.code = #{code}\n")
	public StaffBean getStaffBycode(@Param("code") String code);

	/**
	 * 删除所有的员工信息
	 * @return
	 */
	@Delete("DELETE FROM tblstaff")
	public int deleteAll();
	
	/**
	 * 批量插入员工信息
	 * @param list
	 * @return
	 */
	public int batchInsertStaff(List<StaffBean> list);
	
    /**
     * 获取所有用户信息
     * @return
     */
	@Select("SELECT tb.id AS id,tb.name AS name,tb.code AS code,tb.departmentid AS departmentid,tb.position AS position, " +
            "tb.phone AS phone,tb.mobile AS mobile,tb.email AS email,tb.sex AS sex,tb.idcard AS idcard, " +
            "tb.status AS status,tb.loginid AS account,tb.weighting AS weighting,tb.photourl AS photourl,tb.openid AS openid, " +
            "tb.userid AS userid " +
            "FROM tblstaff tb")
    List<StaffBean> getAllStaff();
}
